﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace MRSite.Cache.Generic
{
    public static class GenericWrapCacheExtensions
    {
        public static TValue Get<TKey, TValue>(this IGenericCache<TKey, TValue> cache,
            TKey key, Func<TValue> func)
        {
            return cache.Get(key, k => func());
        }

        public static Task<TValue> GetAsync<TKey, TValue>(this IGenericCache<TKey, TValue> cache,
            TKey key, Func<Task<TValue>> func)
        {
            return cache.GetAsync(key, k => func());
        }
    }
}
